//clone()加载方法
export class Load{
    static loadCloneModel(arr,scene,object){
        return new Promise((resolve,reject)=>{
            if(arr.length > 1){
                for(let i = 1;i<arr.length;i++){
                    let cloneArr = object.clone();
                    cloneArr.position.set(arr[i][0],arr[i][1],arr[i][2]);
                    //cloneArr.rotation.set(arr[i][0],arr[i][1],arr[i][2]);
                    cloneArr.traverse((child)=> {
                        if (child instanceof THREE.Mesh) {
                            if(child.material instanceof Array){
                                for(let i=0;i<child.material.length;++i){
                                    child.material[i].side =THREE.DoubleSide ;
                                    child.material[i]=child.material[i].clone() ;
                                }
                            } else{
                                child.material=child.material.clone();
                                child.material.side =THREE.DoubleSide;
                            }
                        }
                    });
                    scene.add(cloneArr);
                    resolve(cloneArr)
                }
            }
            reject("arr is error")
        })
    }
}